package com.cloudwise.controller;

import com.cloudwise.entity.ReturnBean;
import com.cloudwise.entity.TestResult;
import com.cloudwise.service.TestResultService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2021/12/1 10:58
 * @description：测试结果controller
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("testResult")
public class TestResultController extends BaseController {

    @Resource
    private TestResultService testResultService;

    /**
     * @param resultList
     * @return ReturnBean
     * @create by: Teacher陈（86521760@qq.com）
     * @description: 批量保存测试结果
     * @create time: 2021/12/1 10:59
     */
    @PostMapping("saveBatchTestResult")
    public ReturnBean saveBatchTestResult(@RequestBody List<TestResult> resultList) {
        boolean saveBatch = testResultService.saveBatch(resultList);
        if (saveBatch) {
            return success(null);
        } else {
            return fail(null);
        }


    }

}
